<template>
  <view class="page">
    <view class="">
      <brandManagerItem v-for="item in pageData" :data="item" />
    </view>
  </view>
</template>

<script setup>
  import { ref, computed } from 'vue';
  import { onShow, onLoad } from '@dcloudio/uni-app';

  import brandManagerItem from '../../components/brandManagerItem/brandManagerItem.vue';
  import { queryMerchant } from '../../apis/pages';

  const testData = ref([
    {
      name: '测试品牌1',
      status: '待审核',
      img: '/static/demo.png',
      shopList: [
        {
          name: '聚合面馆',
          status: '待审核',
          address: '安徽省六安市裕安区xx广场10110号',
          businessHours: '09:00-18:00',
          img: '/static/demo.png',

          goodsList: [
            {
              name: '打卤面',
              img: '/static/demo.png',
            },
            {
              name: '西红柿鸡蛋炒面',
              img: '/static/demo.png',
            },
            {
              name: '打卤面',
              img: '/static/demo.png',
            },
            {
              name: '打卤面',
              img: '/static/demo.png',
            },
          ],
        },

        {
          name: '聚合炸鸡',
          status: '已通过',
          address: '安徽省六安市裕安区xx广场10110号',
          businessHours: '09:00-18:00',
          goodsList: [],
          img: '/static/demo.png',
        },
      ],
    },
    {
      name: '测试品牌2',
      status: '已通过',
      img: '/static/demo.png',

      shopList: [
        {
          name: '牛炖牛肉面',
          img: '/static/demo.png',

          status: '已通过',
          address: '安徽省六安市裕安区xx广场10110号',
          businessHours: '09:00-18:00',
        },
        {
          name: '牛炖牛肉面',
          img: '/static/demo.png',

          status: '待审核',
          address: '安徽省六安市裕安区xx广场10110号',
          businessHours: '09:00-18:00',
        },
      ],
    },
  ]);

  const pageData = ref();

  onLoad(() => {
    console.log('onLoad');

    getPageData();
  });

  function getPageData() {
    // 获取页面数据

    queryMerchant({
      id: uni.getStorageSync('merchantId'),
    }).then((res) => {
      console.log(res, 'res >>>>>>');
      pageData.value = res.data;
    });
  }
</script>

<style scoped lang="scss">
  .page {
    width: 100vw;
    min-height: 100vh;
    padding: 20rpx;
    box-sizing: border-box;
    font-size: 28rpx;
    background-color: #f5f5f5;
  }

  .content {
    background-color: #fff;
    padding: 20rpx;
    border-radius: 16rpx;
    box-sizing: border-box;
    margin-bottom: 30rpx;
  }
</style>
